﻿using System;
using Bingosoft.Modules.SecurityConsole.Role;
using Bingosoft.Web.Utils;

namespace Bingosoft.WebApp.Modules.SecurityConsole.Role
{
    public partial class RoleUser : System.Web.UI.BasePage
    {
        private RoleService _roleServie;
        private RoleService RoleService
        {
            get
            {
                return _roleServie ??
                       (_roleServie = ObjectHelper.GetObject<RoleService>());
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void DelUserRoles(object sender, EventArgs e)
        {
            string roleId = Request["RoleId"];
            String[] userIds = SmartGridView1.GetCheckedValues();

            this.RoleService.DeleleUserRoles(roleId,userIds);

            this.GridSearch.Refresh();
        }

        protected void AddUsersForRole(object sender, EventArgs e)
        {
            string roleId = Request["RoleId"];
            string userIds = this.UserIds.Value;

            this.RoleService.AddUserRoles(roleId, userIds);

            this.GridSearch.Search();
        }
    }
}